<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'showProducts.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    

	
  </head>
  
  <body>
  	<jsp:include page="/jsp/head.jsp"></jsp:include>
  	<a href="/WebDemo2/jsp/index.jsp" >返回</a>
  	<hr/>
  		
  		<table width="800px" align="center">
  		<tr>
  			<td>商品名称</td>
  			<td>商品价格</td>
  			<td>商品描述</td>
  			<td>商品图片</td>
  			<td></td>
  		</tr>
  		
  		<c:forEach  var="product"   items="${requestScope.products }">
  			<tr>
  				<td>
  					<a href="servlet/ProductServlet?method=getProduct&id=${product.id }">${product.name }</a>
  				</td>
  				<td>${product.cost }</td>
  				<td>${product.info }</td>
  				<td>
  					<c:forTokens items="${product.img }"  delims=","  var="img">
  						<img src="${img }"    border="0"  height="44px"  width="44px" />
  					</c:forTokens>
  				</td>
  				<td>
  					<a href="servlet/CartServlet?method=addToCart&pid=${product.id }" >
  						<img src="/WebDemo2/img/addToCart.gif"   border="0"  />
  					</a>
  				</td>
  			</tr>
  		</c:forEach>
  		
  	</table>
    
  </body>
</html>
